package com.howbuy.tools.source;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

import com.howbuy.base.ToolBase;

/**
 * 将接口文档中的内容转换为bean
 * @author boqi.feng
 *
 */
public class SourceReader {
	private static String path = "source";
	private static String fileName="source.xml";
	
	public static void main(String[] args) throws IOException {
		convertSourceFile(path,fileName);
	}
	
	public static void convertSourceFile(String path,String fileName) throws IOException{
		//1、获取文件
		File[] fileList = ToolBase.readFile(path, null);
		
		
		//2、根据文件内容获取并输出JavaBean
		for(int i=0;i<fileList.length;i++){
			getBeanFile(fileList[i]);
		}
		
		
	}

	private static void getBeanFile(File file) throws IOException{
		
		FileInputStream fis = new FileInputStream(file);
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fis,ToolBase.CHARSET));
		String line = null;
		StringBuffer resBuff=new StringBuffer();
		//按行处理文件
		while ((line = bufferedReader.readLine()) != null) {
			
			System.out.println(line);
			
		}
		
		bufferedReader.close();
	}

}
